<?php
class News_model extends Model
{
	function __construct()
	{
		parent::Model();	
	}	
	function get_short_news_field($id)
	{
		$this->db->where('bl_active',1)	;
		$this->db->where('id_news_category',$id);
		$this->db->select('id_news,lb_title');
		return $this->db->get('xn_news')->result();
	}
	function get_name_category($id_category)
	{
		$this->db->where('bl_active',1)	;
		$this->db->where('id_news_category',$id_category);
		$this->db->select('lb_name');
		return $this->db->get('xn_news_category')->result();
	}
	function get_news_field($id_category)
	{
		//$this->db->where('bl_default',0);
		$this->db->where('bl_active',1);
		$this->db->where('id_news_category',$id_category);
		return $this->db->get('xn_news')->result();
	}
	function get_news_arr($field,$val)
	{
		$this->db->where($field,$val);
		$this->db->join('xn_news_category nc','n.id_news_category = nc.id_news_category');
		$query = $this->db->get('xn_news n');
		return $query->row();
	}
	//-----------------------------------------------------------------------------------------------
	function get_new_default($id_news_category)
	{
		$this->db->where('id_news_category',$id_news_category);
		$this->db->where('bl_default','1');
		$query = $this->db->get('xn_news');
		return $query->row();
	}
	function get_news_option($id_news_category,$num,$offset)
	{
		$this->db->where('id_news_category',$id_news_category);
		$this->db->where('bl_active',1);
		$query = $this->db->get('xn_news',$num,$offset);
		return $query->result();
	}
}
?>